import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/basic_information/device_detection_entity.dart';

DeviceDetectionEntity $DeviceDetectionEntityFromJson(Map<String, dynamic> json) {
  final DeviceDetectionEntity deviceDetectionEntity = DeviceDetectionEntity();
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    deviceDetectionEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    deviceDetectionEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    deviceDetectionEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    deviceDetectionEntity.deleted = deleted;
  }
  final String? detectionPerson = jsonConvert.convert<String>(json['detectionPerson']);
  if (detectionPerson != null) {
    deviceDetectionEntity.detectionPerson = detectionPerson;
  }
  final String? detectionTime = jsonConvert.convert<String>(json['detectionTime']);
  if (detectionTime != null) {
    deviceDetectionEntity.detectionTime = detectionTime;
  }
  final String? deviceId = jsonConvert.convert<String>(json['deviceId']);
  if (deviceId != null) {
    deviceDetectionEntity.deviceId = deviceId;
  }
  final String? filePath = jsonConvert.convert<String>(json['filePath']);
  if (filePath != null) {
    deviceDetectionEntity.filePath = filePath;
  }
  final List<String>? filePathList = (json['filePathList'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (filePathList != null) {
    deviceDetectionEntity.filePathList = filePathList;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    deviceDetectionEntity.id = id;
  }
  final String? notes = jsonConvert.convert<String>(json['notes']);
  if (notes != null) {
    deviceDetectionEntity.notes = notes;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    deviceDetectionEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    deviceDetectionEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    deviceDetectionEntity.updateDate = updateDate;
  }
  return deviceDetectionEntity;
}

Map<String, dynamic> $DeviceDetectionEntityToJson(DeviceDetectionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['detectionPerson'] = entity.detectionPerson;
  data['detectionTime'] = entity.detectionTime;
  data['deviceId'] = entity.deviceId;
  data['filePath'] = entity.filePath;
  data['filePathList'] = entity.filePathList;
  data['id'] = entity.id;
  data['notes'] = entity.notes;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  return data;
}

extension DeviceDetectionEntityExtension on DeviceDetectionEntity {
  DeviceDetectionEntity copyWith({
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? detectionPerson,
    String? detectionTime,
    String? deviceId,
    String? filePath,
    List<String>? filePathList,
    String? id,
    String? notes,
    String? updateBy,
    String? updateById,
    String? updateDate,
  }) {
    return DeviceDetectionEntity()
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..detectionPerson = detectionPerson ?? this.detectionPerson
      ..detectionTime = detectionTime ?? this.detectionTime
      ..deviceId = deviceId ?? this.deviceId
      ..filePath = filePath ?? this.filePath
      ..filePathList = filePathList ?? this.filePathList
      ..id = id ?? this.id
      ..notes = notes ?? this.notes
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate;
  }
}
